package com.leetcode.dataStruct;

import com.leetcode.math.ListNode;

public class DeleteDuplicatesNode {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode cur = head;
        while(cur!= null && cur.next != null) {
            if(cur.val == cur.next.val) {
                int val = cur.val;
                while(cur.next != null && cur.next.val == val) {
                    cur.next = cur.next.next;
                }
            } else {
                cur = cur.next;
            }
        }
        return head;
    }
}
